package com.dx.MapperProxy.service;

import com.dx.MapperProxy.mapper.UserMapper;
import com.dx.entity.User;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * author: 丁鑫
 * date: 2018/7/18
 * description:
 */
@Service

public class UserService {
//	@Transactional(rollbackFor = Exception.class)
	public void addAndUpdate(UserMapper userMapper){
//		try {
			User user = new User("dxUserMapper", "test1");
//		int i = 10 /0 ;
			userMapper.userInsert(user);
			user.setUsername("dx");
			userMapper.updateUser(user);
		/*}catch (Error e){
			throw new Error();
		}*/
	}
}
